<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/19
 * Time: 10:52
 */

namespace App\Http\Controllers;


class AesController
{
    private  static $key = '1234567891112121';

    /**
     * @param string $input
     * @return string
     * 加密
     */
    public static function encrypt($input = '') {
        $data = openssl_encrypt($input, 'DES-ECB', self::$key, OPENSSL_RAW_DATA);
        $data = base64_encode($data);
        return $data;

    }
    /**
     * 解密
     * @param String input 解密的字符串
     * @param String key   解密的key
     * @return String
     */
    public static function decrypt($input) {
        $data = openssl_decrypt(base64_decode($input), 'DES-ECB', self::$key, OPENSSL_RAW_DATA);
        return $data;
    }
}